<template>
  <el-button icon="ArrowLeft" link @click="jump" />
</template>

<script setup lang="ts">
import { useRouter } from "vue-router";
type Prop = {
  path?: string;
  name?: string;
  to?: string;
  back?: boolean;
};

const props = defineProps<Prop>();

const router = useRouter();

const jump = () => {
  if (props.path) {
    router.push(props.path);
    return;
  }
  if (props.name) {
    router.push(props.name);
    return;
  }
  if (props.to) {
    router.push(props.to);
    return;
  }
  if (props.back) {
    router.go(-1);
    return;
  }
};
</script>

<style lang="scss">
// @import "~@/style/common/mixins.scss";
// @import "~@/style/common/variables.scss";

.back-button {
  cursor: pointer;
  margin-right: 10px;
  font-weight: 600;

  &:active {
    transform: scale(0.85);
  }
}
</style>
